﻿<%@ WebService Language="C#" Class="Servis_Grad" %>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Configuration;
using System.Data.OleDb;

/// <summary>
/// Summary description for Servis_Grad
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
// [System.Web.Script.Services.ScriptService]
public class Servis_Grad : System.Web.Services.WebService {

    public Servis_Grad () {

        //Uncomment the following line if using designed components 
        //InitializeComponent(); 
    }

    [WebMethod]
    public int proveriGrad(String ind)
    {
        int pom = 0;
        String conString = ConfigurationManager.ConnectionStrings["link1"].ConnectionString;

        OleDbConnection conn = new OleDbConnection(conString);

        conn.Open();

        string select = "select ImeGrad from KupeniGradovi";
        OleDbCommand cmd = new OleDbCommand(select, conn);

        OleDbDataReader i = cmd.ExecuteReader();
        while (i.Read())
        {
            if ((i.GetValue(0).ToString()) == ind)
            {
                pom = 1;
            }
        }
        conn.Close();
        
        return pom;

       
    }
    
    
}
